package cn.t.persistence.mapper.user;

import cn.t.model.user.UserQueryDO;
import cn.t.persistence.entity.user.UserInfoPO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 用户信息表领域对象与实体对象转换
 * @author l
 */

public interface UserInfoMapper extends BaseMapper<UserInfoPO> {
    /**
     * 获取用户权限
     */
    @Select({" SELECT u.id as id," +
            "   u.card_code as cardCode " +
            "   FROM t_user_query AS u " +
            "  left join picking_user_rule AS pur on pur.user_id = u.id " +
            "   left join picking_device_rule AS pdu on pdu.prg_id = pur.prg_id " +
            "    where u.card_code = #{userCarNum}  and u.firm_code = #{firmCode}  and pdu.device_id=#{deviceId} and pur.is_delete = 'N' and   u.is_delete = 'N' " +
            "    order by u.create_at desc " })
    UserQueryDO queryUserRule(@Param("deviceId") Long deviceId, @Param("userCarNum") String  userCarNum, @Param("firmCode") Long  firmCode);

}
